package com.beyondcreative.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.beyondcreative.stylebean.R;

public class TreeFragment extends Fragment {
    private static final String KEY_CONTENT = "TestFragment:Content";

    public static TreeFragment newInstance(String content) {
        TreeFragment fragment = new TreeFragment();

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 20; i++) {
            builder.append(content).append(" ");
        }
        builder.deleteCharAt(builder.length() - 1);
        fragment.setmContent(builder.toString());
        
        return fragment;
    }

    private String mContent = "???";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
            setmContent(savedInstanceState.getString(KEY_CONTENT));
        }
        Log.d("ahn", "fragement Created TreeFragment");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    	
    	FrameLayout layout = (FrameLayout) inflater.inflate(
				R.layout.tree_layout, container, false);
        return layout;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putString(KEY_CONTENT, getmContent());
    }

	public String getmContent() {
		return mContent;
	}

	public void setmContent(String mContent) {
		this.mContent = mContent;
	}
}
